package com.example.evanproject.controller;
import com.example.evanproject.mapper.ExcellentMapper;
import com.example.evanproject.service.impl.ExcellentServiceImpl;
import com.example.evanproject.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController

@CrossOrigin
@RequestMapping("/good")
public class ExcellentController {
    @Autowired
    private ExcellentServiceImpl excellentService;

    //获取优选列表
    @RequestMapping("selectdata")
    public AjaxResult selectgoodall(Integer fid){

        return AjaxResult.success( excellentService.selectgoodall(fid));
    }
    @Autowired
    private ExcellentMapper excellentMapper;

    @RequestMapping("selectdoodlist")
    public AjaxResult selectgoodalllist(Integer fid){
        String str=excellentMapper.selectgoodall(fid);
        String[] arr={"0"};
        if(str!=null&&str!=""){
            arr= str.split(",");

        }
        System.out.println(fid);

        return AjaxResult.success(arr);

    }


    //修改优选的数据
  @RequestMapping("/updatedata")
    public AjaxResult updatedata(Integer fid,String[] str){
        return AjaxResult.success(excellentService.updatedata(fid,str));
    }



}
